<!DOCTYPE html>
<html lang="zh" xmlns:th="http://www.thymeleaf.org"
	xmlns:shiro="http://www.pollix.at/thymeleaf/shiro">
<meta charset="utf-8">
<head th:include="include :: header">
	
</head>
<!-- 查看关系页面 -->
<body class="white-bg">
	<div class="wrapper wrapper-content animated fadeInRight ibox-content">
		 <form class="form-horizontal m-t" id="form-hatchetAgent-detail" th:object="${agent}">
			 <div class="form-group">
				<label class="col-sm-3 control-label" style="font-weight: bold;">代理商名称：</label>
				<div class="form-control-static" id="agent_agentName" >
				</div>
				<label class="col-sm-3 control-label" style="font-weight: bold;">手机号：</label>
				<div class="form-control-static" id="agent_corpPhone">
				</div>
				<!-- <label class="col-sm-3 control-label" style="font-weight: bold;">名称：</label>
				<div class="form-control-static" id="agent_corpName">
				</div> -->
				<label class="col-sm-3 control-label" style="font-weight: bold;">升级码数量：</label>
				<div class="form-control-static" id="agent_fastCount">
				</div>
				<label class="col-sm-3 control-label" style="font-weight: bold;">账户总金额：</label>
				<div class="form-control-static" id="agent_totalMoney">
				</div>
				<label class="col-sm-3 control-label" style="font-weight: bold;">创建时间：</label>
				<div class="form-control-static" id="agent_createTime">
				</div> 
				<label class="col-sm-3 control-label" style="font-weight: bold;">用户总数：</label>
				<div class="form-control-static" id="merchantCount">
				</div> 
				<label class="col-sm-3 control-label" style="font-weight: bold;">认证用户数：</label>
				<div class="form-control-static" id="activMerchantCount">
				</div> 
				<label class="col-sm-3 control-label" style="font-weight: bold;">经理(未激活)数量：</label>
				<div class="form-control-static" id="goldCount">
				</div> 
				<label class="col-sm-3 control-label" style="font-weight: bold;">经理数量：</label>
				<div class="form-control-static" id="managerCount">
				</div> 
				<label class="col-sm-3 control-label" style="font-weight: bold;">原经纪人数量：</label>
				<div class="form-control-static" id="brokerCount">
				</div> 
				<label class="col-sm-3 control-label">
					<font style="font-weight: bold;">
							代理商等级关系：
					</font>
				</label>
				<div class="form-control-static" >
					<!-- 存放代理商关系 -->
					<font id="showRelation" color="red">
							
					</font>
				</div>
				<!-- 隐藏表单接收代理商id -->
				<input  class="form-control"  style="display: none;" type="text" name="iD" id="iD" th:value="${agent.iD}">
			</div>
    	</form>
    </div>
    <div th:include="include :: footer"></div>
    <script type="text/javascript">
    var prefix = ctx + "system/hatchetAgent";
    var id = $("#iD").val();
    $(document).ready(function () { 
			$.ajax({
		        url:prefix+"/showRelation", //请求后台
		        dataType:"json",
		        type: "GET",
		        async:true,
		       data:"id="+id,
		        success:function(re){
		        	var str ="";
		        	//遍历代理商
		            $.each(re, function(i,item) {
		            	str= str+item.type+" : "+item.agentName+" | ";
		            });
		            var agent = re[0];
		            $("#agent_agentName").text(agent.agentName);			
		            $("#agent_corpPhone").text(agent.corpPhone);		
		            $("#agent_corpName").text(agent.corpName);			
		            $("#agent_fastCount").text(agent.fastCount);			
		            $("#agent_totalMoney").text(agent.totalMoney+" 元");			
		            $("#agent_createTime").text(agent.createTime);	
		            $("#merchantCount").text(agent.merchantCount);//普通用户总数
		            $("#activMerchantCount").text(agent.activMerchantCount);//总激活用户数
		            $("#goldCount").text(agent.goldCount);//经理（未激活）数量
		            $("#managerCount").text(agent.mangerCount);//经理数量
		            $("#brokerCount").text(agent.brokerCount);//经纪人用户数
		            var index = str.lastIndexOf(" | ")
		            str = str.substring(0,index);
		            $("#showRelation").text(str);
		        }
		    });
    	});
 			
    </script>
</body>
</html>